# 定义变量
PROJ = step-3
DATA = solution.gpl
IMAGE = output.eps
EXECUTABLE = step-3

all: build build/$(EXECUTABLE) data.txt final.pdf $(IMAGE)  

build:
	mkdir build

build/$(EXECUTABLE): CMakeLists.txt step-3.cc
	cd build && cmake ..
	cd build && make

data.txt: build/$(EXECUTABLE)
	./build/$(EXECUTABLE)
	./build/$(EXECUTABLE) > data.txt

$(IMAGE): draw.gp
	gnuplot draw.gp

final.pdf: final.tex $(IMAGE) data.txt $(IMAGE)  
	xelatex final.tex


clean:
	rm -f *aux *log *pdf data.txt *.gpl *.eps  *.fdb_latexmk *.fls \
	rm -rf build 
.PHONY: all clean
